<?php

namespace App\Http\Controllers\Api\v1;

use App\Exceptions\ApiErrorException;
use App\Exceptions\ApiException;
use App\Exceptions\BaseException;
use App\Models\Order;
use App\Models\OrderDlzwRisk;
use App\Services\CommonService;
use App\Services\RelationVerifyService;
use App\Services\RiskDlzwService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redis;

class DataController
{
    private $oneITime = 1; // 单位时间 一分钟
    private $oneIMax = 1; // 一个用户Ip一分钟最多仅允许访问访问10次

    private $platITime = 1; // 针对所有用户，单位时间内允许访问的最大次数
    private $platIMax = 1; // 针对所有的用户,该接口最多仅允许访问N次

    //担保大数据
    public function store(Request  $request)
    {
        $ip = $request->ip();
        if($ip!='47.106.72.184'&&$ip!='116.62.243.49'){
            return json_encode(['code'=>'100','msg'=>'非法访问']);
        }
        $post = $request->post();

        if (!$post) {
            throw new ApiException('参数错误',CommonService::HTTP_CODE_FAIL);
        }
        if (!isset($post['merchant_id'])) {
            throw new ApiException('商户号不能为空-参数错误',CommonService::HTTP_CODE_FAIL);
        }
        if (!isset($post['encrypt_data'])) {
            throw new ApiException('数据不能为空-参数错误',CommonService::HTTP_CODE_FAIL);
        }
        if (!isset($post['sign'])) {
            throw new ApiException('签名不能为空-参数错误',CommonService::HTTP_CODE_FAIL);
        }

        $data=RiskDlzwService::otherApiInquire($post);

        return json_encode($data);

    }



}
